package com.gzhryc.shared_device.common.device.dao.db;

import java.io.Serializable;
import java.util.Date;

import com.gzhryc.common.StringTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Index;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.base.enums.ENetworkType;

@Table(name="device_info")
public class Device implements Serializable {

    private static final long serialVersionUID = 1L;

	@Id(auto = false)
    @Column(name = "device_sn",notNull = true,length = 32,note = "设备序列号")
    protected String deviceSn;

    @Index(name="device_type_id")
    @Column(name = "device_type_id",notNull = true,note = "设备类型")
    protected String deviceTypeId;

    @Column(name="device_type_name",notNull = true,note = "设备类型名称")
    protected String deviceTypeName;

    @Column(name = "network_type",notNull = true,defVal = "1",note = "联网类型")
    protected Integer networkType;

    @Column(name="device_fun_codes",length = 255,note = "设备功能项")
    protected String deviceFunCodes;

    @Column(name="device_fun_names",length = 255,note = "设备功能名称")
    protected String deviceFunNames;

    @Column(name = "batch_id",note = "设备批次ID")
    protected String batchId;

    @Index(name="user_id")
    @Column(name = "user_id",note = "用户ID")
    protected Long userId;

    @Column(name = "user_name",note = "用户姓名")
    protected String userName;

    @Column(name = "user_phone",length = 16,note = "用户手机号")
    protected String userPhone;

    @Column(name = "belong_date",note = "归属时间")
    protected Date belongDate;

    @Index(name="place_id")
    @Column(name = "place_id",note = "网点ID")
    protected Long placeId;

    @Column(name = "place_name",length = 32,note = "网点名称")
    protected String placeName;

    @Column(note = "省")
    protected String province;

    @Column(note = "城市")
    protected String city;

    @Column(name = "city_area",note = "城区")
    protected String cityArea;

    @Column(name = "area_code", length = 128, note = "地区ID，以逗号分隔")
    protected String areaCode;

    @Column(name = "bind_note",note = "绑定信息")
    protected String bindNote;

    @Column(name = "deploy_date",note = "部署时间")
    protected Date deployDate;

    @Column(name = "update_date", autoUpdateTime = true, note = "最后修改时间")
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }

    public String getBatchId() {
        return batchId;
    }

    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public Date getBelongDate() {
        return belongDate;
    }

    public void setBelongDate(Date belongDate) {
        this.belongDate = belongDate;
    }

    public String getDeviceTypeId() {
        return deviceTypeId;
    }

    public void setDeviceTypeId(String deviceTypeId) {
        this.deviceTypeId = deviceTypeId;
    }

    public String getDeviceTypeName() {
        return deviceTypeName;
    }

    public void setDeviceTypeName(String deviceTypeName) {
        this.deviceTypeName = deviceTypeName;
    }

    public Integer getNetworkType() {
        return networkType;
    }

    public void setNetworkType(Integer networkType) {
        this.networkType = networkType;
    }

    public String getDeviceFunCodes() {
        return deviceFunCodes;
    }

    public void setDeviceFunCodes(String deviceFunCodes) {
        this.deviceFunCodes = deviceFunCodes;
    }

    public String getDeviceFunNames() {
        return deviceFunNames;
    }

    public void setDeviceFunNames(String deviceFunNames) {
        this.deviceFunNames = deviceFunNames;
    }

    public Long getPlaceId() {
        return placeId;
    }

    public void setPlaceId(Long placeId) {
        this.placeId = placeId;
    }

    public String getPlaceName() {
        return placeName;
    }

    public void setPlaceName(String placeName) {
        this.placeName = placeName;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCityArea() {
        return cityArea;
    }

    public void setCityArea(String cityArea) {
        this.cityArea = cityArea;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getBindNote() {
        return bindNote;
    }

    public void setBindNote(String bindNote) {
        this.bindNote = bindNote;
    }

    public Date getDeployDate() {
        return deployDate;
    }

    public void setDeployDate(Date deployDate) {
        this.deployDate = deployDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    
    public String getNetworkTypeName() {
    	return ENetworkType.note(this.networkType);
    }

    public String getAreaName(){
        if(StringTools.isNotBlank(this.province)){
            return this.province + "-" + this.city + "-"+this.cityArea;
        }
        return null;
    }

    public String getUserInfo(){
        if(StringTools.isNotBlank(this.userName)){
            return this.userName + "("+this.userPhone+")";
        }
        return null;
    }
}
